package com.iweb;

import org.apache.commons.dbcp2.BasicDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//相当于bean.xml
@Configuration
public class AppConfig {
    //id
    @Bean("dataSource2")
    public BasicDataSource CreatedataSource(){

        BasicDataSource dataSource=new BasicDataSource();
        dataSource.setUrl("jdbc:mysql://192.168.189.132:3306/db_info");
        dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        dataSource.setUsername("root");
        dataSource.setPassword("123456");

        return dataSource;
    }
}
